#ifndef _CLIENTCOLLECTION_
#define _CLIENTCOLLECTION_
#include "Client.hpp"
#include "Content/Map.hpp"
#include "Scripting/Scripting.hpp"

#include "string.h"

/** 
* This class is a collection of all connected clients.
* This class is only meant to be used as a collection of all clients,
* and nothing else(No methods to manage the clients themselves).
*/
class ClientCollection: public Scriptable{

public:
    /** 
    * Singleton for the main ClientCollection.
    */
    static ClientCollection* instance;
    
    /**
    * Maximum number of clients allowed in collection.
    */
    int MAX_CLIENTS;
    
private:

    /** 
    * Number of clients in collection.
    */
    int clientCount;

    /** 
    * The client list as an array.
    */
    Client* clientList;

public:

    ClientCollection();
    void setup(int numClients, Map* map);

    int getClientCount();

    Client* addClient();

    void removeClient(int index);
    void removeClient(Client* client);

    Client* operator[](unsigned int i) {
        return &clientList[i];
    }

    virtual void bind(lua_State* luaState);
    virtual void push(lua_State* luaState);

};

#endif